<template>
  <div>
    <button @click="counterStore.increment">{{ count }}</button>
    {{ doubleCount }}
    <el-button type="primary">主要按钮</el-button>
    <ul>
      <li v-for="item in list" :key="item.id">{{ item.title }}></li>
    </ul>
  </div>
</template>

<script setup>
import {testAPI} from './apis/testAPI'
testAPI()
  //useCounterStore
  import { useCounterStore } from '@/stores/counter'
import { storeToRefs } from 'pinia';
import { onMounted } from 'vue';
  //使用store实例对象
  const counterStore = useCounterStore()
  //解构赋值需要加上storeToRefs=>数据state,getters处理,不处理方法
  const { count, doubleCount, list} = storeToRefs(counterStore);
  console.log(counterStore);

  onMounted(() => {
    counterStore.fetchList()
  });
</script>

<style>

</style>
